package com.doupi.partner.dal.constant;

/**
 * 日志类型
 * 
 * @author Alvin Wang
 * @version 1.0.0 @ 2017-04-18
 */
public enum LogTypeEnum {
	INSERT("插入", Byte.valueOf("1")), DELETE("删除", Byte.valueOf("2")), UPDATE("修改", Byte.valueOf("3"));

	private String name;
	private byte code;

	LogTypeEnum(String name, byte code) {
		this.name = name;
		this.code = code;
	}

	public String getName() {
		return name;
	}

	public byte getCode() {
		return code;
	}

	/**
	 * 根据 code获取profile
	 *
	 * @param code
	 *            code
	 * @return {@link LogTypeEnum}
	 */
	public static LogTypeEnum getLogTypeByCode(byte code) {
		for (LogTypeEnum logType : values()) {
			if (code == logType.code) {
				return logType;
			}
		}
		return null;
	}
}
